package org.hackystat.project;

import java.util.Vector;
import javax.xml.datatype.XMLGregorianCalendar;

/**
 * Summary of a projects size and effort.
 * 
 * @author Cam Moore
 * 
 */
public class ProjectSummary {
  private XMLGregorianCalendar date;
  private String projectName;
  private double totalLines;
  private long totalEffort;
  private long durationDays;
  private Vector<DailyEffort> activeDay;

  /**
   * Constructs a ProjectSummary.
   * @param date a XMLGregorianCalendar the summary date.
   * @param name a String the name of the project.
   * @param totalLines a long the total number of lines.
   * @param totalEffort a long the total effort in minutes.
   * @param days a long the number of days.
   */
  public ProjectSummary(XMLGregorianCalendar date, String name, long totalLines, long totalEffort,
      long days) {
    this.date = date;
    this.projectName = name;
    this.totalLines = totalLines;
    this.totalEffort = totalEffort;
    this.durationDays = days;
    this.activeDay = new Vector<DailyEffort>();
  }
  
  /**
   * @return the date
   */
  public XMLGregorianCalendar getDate() {
    return date;
  }

  /**
   * @param date the date to set
   */
  public void setDate(XMLGregorianCalendar date) {
    this.date = date;
  }

  /**
   * @return the projectName
   */
  public String getProjectName() {
    return projectName;
  }

  /**
   * @param projectName the projectName to set
   */
  public void setProjectName(String projectName) {
    this.projectName = projectName;
  }

  /**
   * @return the totalLines
   */
  public double getTotalLines() {
    return totalLines;
  }

  /**
   * @param totalLines the totalLines to set
   */
  public void setTotalLines(double totalLines) {
    this.totalLines = totalLines;
  }

  /**
   * @return the totalEffort
   */
  public long getTotalEffort() {
    return totalEffort;
  }

  /**
   * @param totalEffort the totalEffort to set
   */
  public void setTotalEffort(long totalEffort) {
    this.totalEffort = totalEffort;
  }

  /**
   * @return the durationDays
   */
  public long getDurationDays() {
    return durationDays;
  }

  /**
   * @param durationDays the durationDays to set
   */
  public void setDurationDays(long durationDays) {
    this.durationDays = durationDays;
  }
  /**
   * @return the activeDays
   */
  public long getActiveDays() {
    return activeDay.size();
  }

  /**
   * Adds a DailyEffort to the list of active days.
   * @param effort a DailyEffort.
   */
  public void addActiveDay(DailyEffort effort) {
    activeDay.add(effort);
  }

  /**
   * @return The active days as a Vector<Day>
   */
  public Vector<DailyEffort> getActiveDayVector() {
    return activeDay;
  }
  
  /**
   * Returns a String representation of the project summary.
   * @return A String representation of the project summary.
   * @see java.lang.Object#toString()
   */
  public String toString() {
    StringBuffer buff = new StringBuffer(64);
    buff.append("[On ");
    buff.append(date);
    buff.append(' ');
    buff.append(projectName);
    buff.append(" has ");
    buff.append(totalLines);
    buff.append(" lines and ");
    buff.append(totalEffort);
    buff.append(" min of effort ");
    buff.append(activeDay.size());
    buff.append(" active days.]");
    return buff.toString();
  }
}
